package com.stars.services.impl.mygenerate;

import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.mygenerate.CgConfigDTO;
import com.stars.dao.mapper.mygenerate.CgConfigMapper;
import com.stars.entity.mygenerate.CgConfigEntity;
import com.stars.services.mygenerate.CgConfigAccessService;
import com.stars.dao.mapper.mygenerate.CgConfigMapper;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 我的代码配制 业务逻辑
 * @author dj
 * @date 2019-10-30
 * @version V1.0
 *
 */
@Service
public class CgConfigAccessServiceImpl  extends BaseAccessServiceImpl<CgConfigMapper , CgConfigEntity> implements  CgConfigAccessService {
    @Autowired
    private CgConfigMapper  cgConfigMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<CgConfigDTO> pageList(Integer pageNum, Integer pageSize, CgConfigDTO dto) throws Exception{
        ListPage<CgConfigDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<CgConfigDTO> list = cgConfigMapper.pageQueryCgConfig(listPage);
        PageInfo<CgConfigDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
